package com.fhxy.service;

import com.fhxy.model.domain.User;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.transaction.annotation.Transactional;

import javax.servlet.http.HttpServletRequest;

/**
* @author 卢洋
* @description 针对表【user】的数据库操作Service
* @createDate 2024-06-18 10:20:16
*/
public interface UserService extends IService<User> {



    /**
     * 用户脱敏
     * @param originUser
     * @return
     */
    User getSafetyUser(User originUser);


    /**
     *
     * 用户注册
     * @param userAccount 账户
     * @param userPassword 密码
     * @param checkPassword 验证密码
     * @return
     */
    @Transactional
    long userRegister(String userAccount, String userPassword, String checkPassword);



    /**
     * 用户登录
     * @param userAccount 用户账户
     * @param userPassword 用户密码
     * @param request 获取session
     * @return 脱敏后的用户信息
     */
    User userLogin(String userAccount, String userPassword, HttpServletRequest request);



    /**
     * 用户更改
     * @param user
     * @return
     */
    @Transactional
    boolean updateUser(User user);


    /**
     * 用户注销
     * 从session中去除用户登录信息
     * @param request
     * @return
     */
    int userLogout(HttpServletRequest request);
}
